<html>
<head>
<h1>Edit Selected Student</h1>
</head>
<body>
<?php
	require "config.php";	
	$id = $_POST['id'];
	$con = mysql_connect("localhost",$db_user ,$db_pass);
	// if an error was encountered, the script exits with an error message
	if (!$con){
		die('Could not connect: ' . mysql_error());
    }
	mysql_select_db($db_name, $con);
	$sql_student = "Select * from student where ID = ".$id.";";
	$result = mysql_query($sql_student);
	while($row = mysql_fetch_array($result))
	{
		echo "<form action='editstudentresult.php' method='GET'>";
		echo "Edit Name of the student with ID = ".$row['ID']."<br/>";
		echo "<input type='hidden' name = 'id' value='".$row['ID']."'/> ";
		echo "Name: <input type='text' name = 'name' value='".$row['Name']."'/> <br/>";
		echo "<input type='submit' name = 'create' value='Edit'/>";
		echo "</form>";
	}
	mysql_close($con);
?>
</body>
<br />
<a href="student.php">Home</a>
</html>
